package cn.yangliu.jwt.service.impl;

import cn.yangliu.jwt.entity.User;
import cn.yangliu.jwt.repository.UserRepository;
import cn.yangliu.jwt.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Primary;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author 杨柳
 * @contact QQ: 574789490
 * @date 2019-04-18 10:38
 */
@Service
@Slf4j
@Transactional(rollbackFor = Throwable.class)
@Primary
public class UserServiceImpl extends JpaServiceImpl<User, Long, UserRepository> implements UserService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        return repository.findUserByUsername(username);
    }
}
